package com.entor.service;

import org.springframework.stereotype.Service;


import com.entor.model.User;
import com.hqj.Msg;
import com.hqj.StringUtil;
@Service
public class UserService extends BaseService<User>{

	
	public Msg toLogin(User u){
		Msg m = new Msg();
		String password = u.getPassword();
		u = this.get(u);
		if(u==null){
			m.setMsg("用户不存在");
			m.setSus(false);
		}else{
			if(u.getPassword().
					equals(StringUtil.getMd5(password))){
				m.setMsg("登录成功");
				m.setSus(true);
			}else{
				m.setMsg("密码错误");
				m.setSus(false);
			}
		}
		return m;
	}
}
